package GUI;

import javax.swing.*;
import java.awt.*;

public class Menu {
    JFrame MenuFrame = new JFrame("莆田大亨");
    JLabel jLabel = new JLabel("欢迎来到莆田大亨");
    Font font = new Font("黑体",Font.BOLD,30);
    JButton registerButton = new JButton("注册");
    JButton LoginButtonN = new JButton("用户名登录");
    JButton LoginButtonP = new JButton("手机号登录");
    JButton loginButon = new JButton("管理员登录");
    JButton helpButton = new JButton("帮助");
    JPanel jPanel = new JPanel();

    public void Menu(){
        jLabel.setFont(font);
        jLabel.setHorizontalAlignment(SwingConstants.CENTER);
        jPanel.add(registerButton);
        jPanel.add(LoginButtonN);
        jPanel.add(LoginButtonP);
        jPanel.add(loginButon);
        jPanel.add(helpButton);
        MenuFrame.add(jLabel,BorderLayout.CENTER);
        MenuFrame.add(jPanel,BorderLayout.SOUTH);
        MenuFrame.setSize(500,200);
        MenuFrame.setLocationRelativeTo(null);
        MenuFrame.setVisible(true);
        MenuFrame.setDefaultCloseOperation(2);
        //透明按键
      //  registerButton.setContentAreaFilled(false);
        registerButton.addActionListener(e -> {
            new registerFrame().registerFrame();
            MenuFrame.dispose();
        });

        //透明按键边框
        registerButton.setBorderPainted(false);

        registerButton.setForeground(Color.orange); // 设置按钮前景色字体
        registerButton.setBackground(Color.CYAN);
        registerButton.setFocusPainted(false); // 去掉焦点样式即虚线框

        LoginButtonN.setBorderPainted(false);
        LoginButtonN.setBackground(Color.magenta);
        LoginButtonN.addActionListener(e -> {
            new loginFrameN().loginFrameN();
            MenuFrame.dispose();
        });

        LoginButtonP.addActionListener(e -> {
            new loginFrameP().loginFrameP();
            MenuFrame.dispose();
        });

        loginButon.addActionListener(e -> {
            new AdminLoginFrame().AdminLoginFrame();
            MenuFrame.dispose();
        });

        helpButton.addActionListener(e -> {
            JOptionPane.showMessageDialog(null,"欢迎使用银行自助业务系统！\n\n"
                    + "使用本系统前，请先开通银行业务自助系统服务。\n"
                    + "查询余额：查询当前账户余额。\n"
                    + "取款：按照提示输入取款金额。\n"
                    + "存款：按照提示输入存款金额，存款金额不受限制。\n"
                    + "转账：按照提示输入转账金额和账户号码进行转账操作。\n"
                    + "查询日志：查询系统中的交易日志。\n"
                    + "退出：退出系统退出。\n"
                    + "帮助：查看系统使用帮助。\n");
        });
    }

    public static void main(String[] args) {
        new Menu().Menu();
    }
}
